package com.bootdo.lvyou.domain;

public enum CityGradeEnum {

    QG("全国",0),
    PRIN("省",1),
    CITY("市",2),
    COUNTY("县/区", 3);

    private String name;
    private Integer grade;

    CityGradeEnum(String name, Integer grade) {
        this.name = name;
        this.grade = grade;
    }

    public String getName() {
        return name;
    }

    public Integer getGrade() {
        return grade;
    }

    public static String getGradeByName(int grade){
        for(CityGradeEnum item :  CityGradeEnum.values()){
            if(item.grade == grade){
                return item.name;
            }
        }
        return null;
    }

}
